﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TDB.DBInternals;

namespace TDB.Communication
{
  public static class ServiceExtensions
  {
    public static void Set<T>(this T entity, string databasename)
    {
      var store = StoreManager.GetStore<T>(databasename);
      store.Set(entity);
    }

    public static void SetCollection<T>(this IEnumerable<T> entities, string databasename)
    {
      var store = StoreManager.GetStore<T>(databasename);
      foreach (var e in entities)
        store.Set(e);
    }
  }
}
